/**
*      author: Y_Yao
*      created: 2025-03-22 15:29:53
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 9e18;
const int INF = 0x3f3f3f3f;
const int N = 1e3 + 7;
int fa[2 * N],sz[2 * N];
int n,m,q;
struct node
{
    int u,v,w,id;
};

node edg[N];

bool cmp(const node& n1,const node& n2)
{
    return n1.w > n2.w;
}

int find(int x)
{
    return fa[x] == x ? x : fa[x] = find(fa[x]);
}

void Union(int u,int v)
{
    u = find(u);
    v = find(v);
    if(u == v) return;
    if(sz[u] > sz[v]) swap(u,v);
    fa[u] = v;
    sz[v] += sz[u];
}

void solve()
{
    cin >> n >> m >> q;
    for(int i = 1;i <= m;i++)
    {
        int u,v,w;
        cin >> u >> v >> w;
        edg[i] = {u,v,w,i};
    }
    sort(edg + 1,edg + m + 1,cmp);
    while(q--)
    {
        int ans = -1;
        for(int i = 1;i <= n * 2;i++)
        {
            fa[i] = i;
            sz[i] = 1;
        }
        int l,r;
        cin >> l >> r;
        for(int i = 1;i <= m;i++)
        {
            if(edg[i].id >= l && edg[i].id <= r)
            {
                if(find(edg[i].u) == find(edg[i].v))
                {
                    ans = edg[i].w;
                    break;
                }
                else
                {
                    Union(edg[i].u + n,edg[i].v);
                    Union(edg[i].u,edg[i].v + n);
                }
            }
        }
        cout << ans << endl;
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}